# -*- coding: utf-8 -*-
import logging
from Products.Archetypes import atapi
from Products.Archetypes.ClassGen import generateMethods

from plone.app.blob.content import ATBlob

LOG = logging.getLogger(__name__)

ATBlob.schema.addField(
    atapi.StringField(
        'redirect',
        required=0,
        searchable=0,
    widget=atapi.StringWidget(description="Fournissez le lien de redirection sur l\'image.",
                      label="URL"),
    validators=('isURL')))

ATBlob.schema.addField (
    atapi.BooleanField(
        'displayedincarousel',
        required=0,
        searchable=0,
        widget=atapi.BooleanWidget(label="Afficher l'image dans le carrousel."))
    )

generateMethods(ATBlob, ATBlob.schema.fields())

LOG.info('PATCHED plone.app.blob.content.ATBlob.schema to add redirect and displayedincarousel fields')
